from db import db

class Configuration(db.Model):
    __tablename__ = 'configuration'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    weight_name = db.Column(db.String(255),nullable=False)
    learning_rate = db.Column(db.Double, nullable=False)
    epoch = db.Column(db.Integer, nullable=False)
    threshold = db.Column(db.Double, nullable=False)

    def __init__(self,weightName,learningRate,epoch,threshold):
        self.weight_name = weightName
        self.learning_rate = learningRate
        self.epoch = epoch
        self.threshold = threshold

    def to_dict(self):
        return {
            'id': self.id,
            'weightName': self.weight_name,
            'learningRate': self.learning_rate,
            'epoch': self.epoch,
            'threshold': self.threshold
        }